function sameSign(a, b) {
    return (a ^ b) >= 0
}
function vector(a, b) {
    return {
        x: b.x - a.x,
        y: b.y - a.y
    }
}
function vectorProduct(v1, v2) {
    return v1.x * v2.y - v2.x * v1.y
}
function isPointIntrangle(p, a, b, c) {
    // console.log(p);
    // console.log(a);
    // console.log(b);
    // console.log(c);
    var pa = vector(p, a);
    var pb = vector(p, b);
    var pc = vector(p, c);

    var t1 = vectorProduct(pa, pb);
    var t2 = vectorProduct(pb, pc);
    var t3 = vectorProduct(pc, pa);

    return sameSign(t1, t2) && sameSign(t2, t3)
}
function needDelay(elem, leftCorner, currMousePos) {
    var offset = elem.offset();

    var topLeft = {
        x: offset.left,
        y: offset.top
    }


    var bottomLeft = {
        x: offset.left,
        y: offset.top + elem.height()
    }
    return isPointIntrangle(currMousePos, leftCorner, topLeft, bottomLeft)

}